<?php
/**
 * Copyright (c) 2003-08  PHPWind.net. All rights reserved.
 * 
 * @filename: helper.php
 * @author: shenhj 
 * @modify: MON Nov 10 14:26:58 CST 2008
 */
class helper {
	var $db;
	function __construct(&$db) {
		$this->helper(&$db);
	}
	
	function helper(&$db) {
		$this->db 	= $db->db;
	}
	function getfriends($uid){
		$frienddb = array();
		$query=$this->db->query("SELECT friendid FROM pw_friends WHERE uid=".pwEscape($uid)." AND status='0'");
		while($rs = $this->db->fetch_array($query)){
			$frienddb[] = $rs['friendid'];
		}
		return $frienddb;		
	}
	
	
	function getgender($uid){
		$rs = $this->db->get_one("SELECT gender FROM pw_members WHERE uid=".pwEscape($uid));
		return $rs;	
	}
	
	function geticon($uid){
		$rt = $this->db->get_one("SELECT icon, username, uid FROM pw_members WHERE uid=".pwEscape($uid));
		$rt && list($rt['icon']) = showfacedesign($rt['icon'],true);
		return $rt;
	}
	
	function checkfriend($uid, $friend) {
		$rt = $this->db->get_one("SELECT friendid FROM pw_friends WHERE uid=".pwEscape($uid)." AND friendid=".pwEscape($friend)." AND status='0'");
		if($rt){
			return true;
		}
		return false;
	}
	
	
	
}